package cn.iocoder.yudao.module.order.dal.mysql.payorder;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.order.dal.dataobject.payorder.PayOrderDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.order.controller.admin.payorder.vo.*;

/**
 * 支付订单 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface PayOrderMapper extends BaseMapperX<PayOrderDO> {

    default PageResult<PayOrderDO> selectPage(PayOrderPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<PayOrderDO>()
                .eqIfPresent(PayOrderDO::getPaymentNumber, reqVO.getPaymentNumber())
                .eqIfPresent(PayOrderDO::getMerchantOrderNumber, reqVO.getMerchantOrderNumber())
                .eqIfPresent(PayOrderDO::getPaymentAmount, reqVO.getPaymentAmount())
                .eqIfPresent(PayOrderDO::getStatus, reqVO.getStatus())
                .eqIfPresent(PayOrderDO::getPaymentProduct, reqVO.getPaymentProduct())
                .betweenIfPresent(PayOrderDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(PayOrderDO::getId));
    }

    default List<PayOrderDO> selectList(PayOrderExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<PayOrderDO>()
                .eqIfPresent(PayOrderDO::getPaymentNumber, reqVO.getPaymentNumber())
                .eqIfPresent(PayOrderDO::getMerchantOrderNumber, reqVO.getMerchantOrderNumber())
                .eqIfPresent(PayOrderDO::getPaymentAmount, reqVO.getPaymentAmount())
                .eqIfPresent(PayOrderDO::getStatus, reqVO.getStatus())
                .eqIfPresent(PayOrderDO::getPaymentProduct, reqVO.getPaymentProduct())
                .betweenIfPresent(PayOrderDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(PayOrderDO::getId));
    }

}
